<?php
class PressNavModel extends Model {

    protected $_validate = array(
        array('name', '2,20', '栏目名称长度必须为2~20位', 0, 'length', 1),
        array('info', '0,255', '栏目描述长度必须为255位以内', 0, 'length')
    );

    protected $_auto = array(
        array('sort', 'createSort', 1, 'callback')
    );

    public function createSort() {
        $tmp = $this->query("SHOW TABLE STATUS LIKE '__TABLE__'");
        return $tmp[0]['Auto_increment'];
    }

}

?>